
// 工单统计
let type = 6; //近n个月的
let month = new Date().getMonth(); //当前月份
let year = new Date().getFullYear(); //今年
let dateArr = [];
for (let i = 1; i <= type; i++) {
  let date = '';
  if (month >= i) {
    date = (month - i + 1)+'月';
  } else {
    date = (12 + month - i + 1)+'月';
  }
  dateArr.push(date);
}
dateArr.reverse();
let workOrderCountOption = {
    tooltip: {
      backgroundColor: 'rgba(0, 0, 0, 0.25)',
      borderColor: 'rgba(0, 0, 0, 0.1)',
      trigger: 'axis',
      textStyle: { color: '#fff' }
    },
    legend: {
      top: '20',
      // right: '120',
      data: ['维修工单', '保养工单'],
      textStyle: {
        color: '#606266'
      },
      itemHeight: 10,
      itemWidth: 20
    },
    xAxis: [
      {
        type: 'category',
        data: dateArr,
        // boundaryGap: false,
        axisPointer: {
          type: 'shadow',
        },
        axisLabel: {
          color: '#666666'
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: '#F2F6FC'
          },
        }
      }
    ],
    // xAxis: {
    //   type: 'category',
    //   boundaryGap: false,
    //   data: dateArr,
    //   axisLine: {
    //     lineStyle: {
    //       color: '#F2F6FC'
    //     }
    //   }
    // },
    yAxis: {
      minInterval: 1,
      axisLine: {
        show: true,
        lineStyle: {
          color: '#F2F6FC',
          fontSize: 18
        }
      },
      splitLine: {
        show: true,
        lineStyle: {
          color: '#F2F6FC',
        }
      },
      axisLabel: {
        color: '#999999',
        padding: 3
      },
      axisTick: {
        show: true
      },
      type: 'value'
    },
    series: [
      {
        name: '维修工单',
        type: 'line',
        data:  [2,3,4,5,6,7],
        itemStyle: {
          color: '#3378FF'
        }
      },
      {
        name: '保养工单',
        type: 'line',
        data: [3,5,7,8,1,2],
        itemStyle: {
          color: '#75E472'
        }
      },
      
    ]
}
// 近6月通知统计
let monthNoticeCountOption = {
  tooltip: {
    backgroundColor: 'rgba(0, 0, 0, 0.25)',
    borderColor: 'rgba(0, 0, 0, 0.1)',
    trigger: 'axis',
    textStyle: { color: '#fff' }
  },
  textStyle: {
    color: '#606266'
  },
  legend: {
    top: '20',
    // right: '120',
    data: ['保养总数', '报警总数'],
    textStyle: {
      color: '#606266'
    },
    itemHeight: 10,
    itemWidth: 10
  },
  xAxis: [
    {
      type: 'category',
      data: dateArr,
      axisPointer: {
        type: 'shadow'
      },
      axisLabel: {
        color: '#666666'
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#F2F6FC'
        }
      }
    }
  ],
  yAxis: {
    minInterval: 1,
    type: 'value',
    show: true,
    axisLine: {
      show: true,
      lineStyle: {
        color: '#F2F6FC',
        fontSize: 18
      }
    },
    splitLine: {
      show: true,
      lineStyle: {
        color: '#F2F6FC',
      }
    },
    axisLabel: {
      color: '#999999',
      padding: 3
    },
    axisTick: {
      show: true
    }
  },
  series: [
    {
      name: '保养总数',
      type: 'bar',
      barGap: 1,
      data: [1,2,3,4,6,7],
      itemStyle: {
        color: '#DCB0FF',
        borderRadius: [6, 6, 0, 0]
      }
    },
    {
      name: '报警总数',
      type: 'bar',
      barGap: 1,
    
      data: [2,3,4,5,4,8],
      itemStyle: {
        color: '#F56C6C',
        borderRadius: [6, 6, 0, 0]
      }
    }
  ]
};



export default { workOrderCountOption, monthNoticeCountOption};
